﻿@model Beeldbankmvc.Models.LocationsModel
@using Beeldbankmvc.Code
@using Beeldbankmvc.Controllers
@using Beeldbankmvc.Models
@using MvcSiteMapProvider.Web.Html
@using System.Configuration
@{
    ViewBag.Title = "Beeldarchief Rijkswaterstaat";
    Layout = "../Shared/Layout.cshtml";
    Html.RenderAction("AdminMenu", "Miscellaneous");
}
<h2>Gebied aanpassen</h2>
<script src="@AppHelper.getContent("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@AppHelper.getContent("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
@using (Html.BeginForm())
{
    <fieldset>
        <div class="line">
            <div class="unit size23">
                <legend style="display: none;">Velden</legend>
                <div class="display-label">
                    LB Lat (Y-as)
                </div>
                <div class="display-field">
                    @if (!String.IsNullOrEmpty(Request.QueryString["topLeftLat"]))
                    {
                        <input type="text" name="topLeftLat" id="topLeftLat" value="@Html.Raw(Request.QueryString["topLeftLat"])"/>
                    }
                    else
                    { 
                        <input type="text" name="topLeftLat" id="topLeftLat" value="@Model.topLeftLatitude"/>
                    }
                </div>
                <div class="display-label">
                    RO Lat (Y-as)
                </div>
                <div class="display-field">
                    @if (!String.IsNullOrEmpty(Request.QueryString["topRightLat"]))
                    {
                        <input type="text" name="topRightLat" id="topRightLat" value="@Html.Raw(Request.QueryString["topRightLat"])"/>
                    }
                    else
                    {
                        <input type="text" name="topRightLat" id="topRightLat" value="@Model.topRightLatitude"/>
                    }
                </div>
                <div class="display-label">
                    Hoogte
                </div>
                <div class="display-field">
                    @if (!String.IsNullOrEmpty(Request.QueryString["topRightLat"]))
                    {
                        @Html.Raw(Convert.ToString(Convert.ToDouble(Request.QueryString["topLeftLat"]) - Convert.ToDouble(Request.QueryString["topRightLat"])))
                    }
                    else
                    {
                        @Html.Raw(Convert.ToString(Model.topLeftLatitude - Model.topRightLatitude)) 
                    }
                </div>
                <div class="display-label">
                    LB Long (X-as)
                </div>
                <div class="display-field">
                    @if (!String.IsNullOrEmpty(Request.QueryString["topLeftLon"]))
                    {
                        <input type="text" name="topLeftLon" id="topLeftLon" value="@Html.Raw(Request.QueryString["topLeftLon"])"/>
                    }
                    else
                    {
                        <input type="text" name="topLeftLon" id="topLeftLon" value="@Model.topLeftLongitude"/>
                    }
                </div>
                <div class="display-label">
                    RO Long (X-as)
                </div>
                <div class="display-field">
                    @if (!String.IsNullOrEmpty(Request.QueryString["topRightLon"]))
                    {
                        <input type="text" name=topRightLon id="topRightLon" value="@Html.Raw(Request.QueryString["topRightLon"])"/>
                    }
                    else
                    {
                        <input type="text" name=topRightLon id="topRightLon" value="@Model.topRightLongitude"/>
                    }
                </div>
                <div class="display-label">
                    Breedte
                </div>
                <div class="display-field">
                    @if (!String.IsNullOrEmpty(Request.QueryString["topRightLat"]))
                    {
                        @Html.Raw(Convert.ToString(Convert.ToDouble(Request.QueryString["topRightLon"]) - Convert.ToDouble(Request.QueryString["topLeftLon"])))
                    }
                    else
                    {
                        @Html.Raw(Convert.ToString(Model.topRightLongitude - Model.topLeftLongitude)) 
                    }
                </div>
                <div class="display-label">
                    Achtergrondimage
                </div>
                <div class="display-field">
                    @if (!String.IsNullOrEmpty(Request.QueryString["imageName"]))
                    {
                        <input type="text" name="imageName" value="@Html.Raw(Request.QueryString["imageName"])"/>
                    }
                    else
                    { 
                        <input type="text" name="imageName" value="@Model.imageName"/>
                    }
                </div>
                <div class="display-label">
                    Naam gebied
                </div>
                <div class="display-field">
                    @if (!String.IsNullOrEmpty(Request.QueryString["areaName"]))
                    {
                        <input type="text" name="areaName" value="@Html.Raw(Request.QueryString["areaName"])"/>
                    }
                    else
                    { 
                        <input type="text" name="areaName" value="@Model.areaName"/>
                    }
                </div>
            </div>
            <div class="unit size13">
                <p>
                    <a title="Toon de overzichtskaart van Nederland" href="@Url.Action("Index", "Gebied")">
                    <img alt="Toon de overzichtskaart van Nederland" title="Toon de overzichtskaart van Nederland" src="@AppHelper.getContent("~/Content/images/maps/top250-2-66.png")" />Kaart van Nederland</a><br />
                    <input type="submit" name="submit" value="Opslaan" />
                    | <input type="submit" name="submit" value="Refresh" />
                    <br/>
                    Gebruik het volgende script om het aangemaakte/aangepaste gebied toegankelijk te maken op live: <a href="/Gebied/GenerateSQLViewCode">SQL script</a>.
                </p>
            </div>
        </div>
    </fieldset>
    <div class="line">
        <p>
            @Html.Raw(Url.Image<GebiedController>(c => c.DisplayDotsOnMap(Model.topLeftLatitude, Model.topLeftLongitude, Model.topRightLatitude, Model.topRightLongitude, Model.imageName, Model.FromDate.ToString(), Model.ToDate.ToString(), true, -1), 660, "Klikbare kaart " + Model.areaName, "Klikbare kaart " + Model.areaName, null, "#kaart"))
            <map name="kaart" id="kaart">
                @foreach (var location in Model.locationListDraw)
                { 
                    <area shape="rect" coords="@location.x ,@location.y,@(location.x + 7),@(location.y + 7)" href="@AppHelper.getContent("~/MediaObject/Edit/" + location.Id + "")"  alt="@location.Title" />
                }
            </map>
        </p>
    </div>
}